package com.example.core.controller;

import com.example.core.service.JGroupsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.UUID;

@RestController
public class JGroupsController {

    Logger logger = LoggerFactory.getLogger(getClass());

    @Resource
    private JGroupsService jGroupsService;

    @RequestMapping("send")
    public String send() throws Exception {
        String uuid = UUID.randomUUID().toString();
        jGroupsService.broadcast(uuid);
        return uuid;
    }
}
